home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 25
/
AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso
/
PublicDomain
/
Spiele
/
Atoms
/
ATOMS.ASM
< prev
next >
Wrap
Assembly Source File
|
1999-12-08
|
29KB
|
1,837 lines
; Watch out! It's The ATOMS game on the Amiga!!!! Done by Tom. Excellent.
openlibrary = -552
allocmem = -198
freemem = -210
logosize = 40*44*3
memsize = 40*200*4+logosize
bplcon0 = $100
bplcon1 = $102
bplcon2 = $104
bpl1mod = $108
bpl2mod = $10a
ddfstrt = $92
ddfstop = $94
diwstrt = $8e
diwstop = $90
bpl1pth = $e0
bpl1ptl = $e2
bpl2pth = $e4
bpl2ptl = $e6
bpl3pth = $e8
bpl3ptl = $ea
bpl4pth = $ec
bpl4ptl = $ee
col00 = $180
col01 = $182
col02 = $184
col03 = $186
col04 = $188
col05 = $18a
col06 = $18c
col07 = $18e
col08 = $190
col09 = $192
col10 = $194
col11 = $196
col12 = $198
col13 = $19a
col14 = $19c
col15 = $19e
col16 = $1a0
col17 = $1a2
col18 = $1a4
col19 = $1a6
spr0pth = $120
spr0ptl = $122
spr1pth = $124
spr1ptl = $126
spr2pth = $128
spr2ptl = $12a
spr3pth = $12c
spr3ptl = $12e
spr4pth = $130
spr4ptl = $132
spr5pth = $134
spr5ptl = $136
spr6pth = $138
spr6ptl = $13a
spr7pth = $13c
spr7ptl = $13e
section Atoms+++++++++,CODE_C
start:
lea $dff000,a5
bsr killsystem
bsr waitblit
bsr allocate
tst.l d0
beq.s error
bsr initvars2
bsr newcopper
playagain:
jsr mt_init
bsr initvariables
bsr askplayers
bsr initcolours
st musicflag
bsr startscreen
bsr mainloop
tst.b d4
beq.s playagain
bsr waitblit
bsr oldcopper
bsr free
jsr mt_end
error:
bsr freesystem
clr.l d0
rts
waitblit:
btst #14,2(a5)
bne.s waitblit
rts
blankplane:
btst #14,2(a5)
bne.s blankplane
move.l planeaddr,$54(a5)
clr.w $42(a5)
clr.w $66(a5)
move.l #-1,$44(a5)
move.w #%100000000,$40(a5)
move.w #200*64+20,$58(a5)
rts
blankplane2:
btst #14,2(a5)
bne.s blankplane2
move.l planeaddr,$54(a5)
clr.w $42(a5)
clr.w $66(a5)
move.l #-1,$44(a5)
move.w #%100000000,$40(a5)
move.w #800*64+20,$58(a5)
rts
askplayers:
bsr blankplane2
bsr waitblit
lea text1,a0
move.w #40*20,d0
bsr textoutput
lea text2,a0
move.w #40*50+16,d0
bsr textoutput
wb:
btst #6,$bfe001
bne.s wb
move.w mousex,d0
move.w mousey,d1
cmp.w #45,d1
blt.s wb
cmp.w #60,d1
bgt.s wb
cmp.w #118,d0
blt.s wb
moveq #2,d4
cmp.w #145,d0
blt.s hit
moveq #3,d4
cmp.w #178,d0
blt.s hit
moveq #4,d4
cmp.w #208,d0
bgt.s wb
hit:
subq #1,d4
move.w d4,players
move.w d4,playerno
rts
textoutput:
lea font,a2
move.l planeaddr,a1
add.w d0,a1
nextchar:
clr.w d0
move.b (a0)+,d0
blt.s endtext
sub.b #'a',d0
blt.s space
add.w d0,d0
moveq #15,d7
move.l a1,a3
textloop:
move.w 0(a2,d0.w),(a3)
add.w #480/8,d0
lea 40(a3),a3
dbf d7,textloop
space:
lea 2(a1),a1
bra.s nextchar
endtext:
rts
startscreen:
cmp.w #1,framecount
blt.s startscreen
clr.w framecount
move.w #1590,d0
sub.w distance,d0
move.w d0,rot
bsr rotateaxis
bsr blankplane
bsr drawgrid
add.w #20,distance
cmp.w #1610,distance
ble.s startscreen
bsr initscreen
rts
rotateaxis:
move.w rot,d0
add.w d0,d0
lea sinewave,a0
lea 1800(a0),a1
move.w 0(a1,d0.w),d1
move.w 0(a0,d0.w),d0
move.w d0,sin1+2
move.w d0,sin2+2
move.w d1,cos1+2
move.w d1,cos2+2
rts
rotate:
movem.w d0-1,-(sp)
move.w d2,d0
move.w d3,d1
sin1 muls #0,d2
cos1 muls #0,d3
add.l d2,d3
asr.l #7,d3
sin2 muls #0,d1
cos2 muls #0,d0
sub.l d1,d0
asr.l #7,d0
move.w d0,d2
movem.w (sp)+,d0-1
rts
drawgrid:
lea coords,a0
move.w (a0)+,d7
nextline:
move.w (a0)+,d2
move.w (a0)+,d3
bsr rotate
move.w distance,d4
move.w d2,d0
move.w d3,d1
ext.l d0
ext.l d1
asl.l #8,d0
asl.l #8,d1
divs d4,d0
divs d4,d1
add.w #160,d0
add.w #96,d1
move.w (a0)+,d2
move.w (a0)+,d3
bsr rotate
move.w distance,d4
ext.l d2
ext.l d3
asl.l #8,d2
asl.l #8,d3
divs d4,d2
divs d4,d3
add.w #160,d2
add.w #96,d3
bsr drawline
dbf d7,nextline
rts
initvars2:
clr.w musicflag
clr.w colours+6
st fadeflag
clr.w slider
clr.w framecount
move.w #-16,slider2
clr.w mousex
clr.w mousey
clr.w oldmousex
clr.w oldmousey
rts
initvariables:
clr.w xrot
move.w #650,yrot
clr.w rot
clr.w explosion
move.w #-1,winner
move.w #20,distance
clr.w quitflag
clr.w player
lea playersin,a0
move.l #$01010101,(a0)
lea startdata,a0
lea enddata,a1
loop10:
clr.b (a0)+
cmp.l a0,a1
bne.s loop10
lea blocklookup,a0
lea tiles+32,a1
move.w #255,d7
clr.l d2
loop13:
move.l d2,d3
divu #19,d3
move.l d3,d4
swap d4
add.w d4,d4
mulu #38*16,d3
add.w d4,d3
lea 0(a1,d3.w),a2
move.l a2,(a0)+
add.w #1,d2
dbf d7,loop13
rts
drawline:
movem.l d0-7/a0-6,-(sp)
bsr clipping
tst.w d5
bne noline
moveq #40,d4
muls d1,d4
moveq #-$10,d5
and.w d0,d5
asr.w #3,d5
add.w d5,d4
add.l planeaddr,d4
clr.l d5
sub.w d1,d3
roxl.b #1,d5
tst.w d3
bge.s y2gy1
neg.w d3
y2gy1:
sub.w d0,d2
roxl.b #1,d5
tst.w d2
bge.s x2gx1
neg.w d2
x2gx1:
move.w d3,d1
sub.w d2,d1
bge.s dygdx
exg d2,d3
dygdx:
roxl.b #1,d5
tst.w d3
beq noline
wblit:
btst #14,2(a5)
bne.s wblit
move.b octant_table(pc,d5.w),d5
add.w d2,d2
move.w d2,$62(a5)
sub.w d3,d2
bgt.s signn1
or.b #$40,d5
signn1:
move.w d2,$52(a5)
sub.w d3,d2
move.w d2,$64(a5)
move.w #$8000,$74(a5)
move.w #$ffff,$72(a5)
move.w #$ffff,$44(a5)
and.w #$f,d0
ror.w #4,d0
or.w #$bca,d0
move.w d0,$40(a5)
move.w d5,$42(a5)
move.l d4,$54(a5)
move.l d4,$48(a5)
move.w #40,$66(a5)
move.w #40,$60(a5)
lsl.w #6,d3
addq #2,d3
move.w d3,$58(a5)
noline:
movem.l (sp)+,d0-7/a0-6
rts
octant_table dc.b 1,17,9,21,5,25,13,29
initscreen:
lea blocksequ,a0
move.w #59,d7
nextblock6:
cmp.w #1,framecount
blt.s nextblock6
clr.w framecount
move.w (a0)+,d0
ext.l d0
divu #10,d0
move.l d0,d1
swap d0
move.w #19*12,d2
bsr drawblock
dbf d7,nextblock6
lea playersin,a0
move.w #19*12+2,d2
clr.w d0
moveq #6,d1
move.w players,d7
playerloop:
bsr drawblock
addq #1,d0
addq #1,d2
dbf d7,playerloop
rts
mainloop:
cmp.w #1,framecount
blt.s mainloop
clr.w framecount
bsr morphhandle
bsr leftclick
bsr playerhandler
btst #10,$16(a5)
beq nowinn
add.w #1,toggler
and.w #1,toggler
tst.w quitflag
beq.s mainloop
sf musicflag
jsr mt_end
lea text3,a0
move.w #40*8+12,d0
bsr textoutput
lea text4,a0
move.w #40*26+6,d0
bsr textoutput
wb2:
btst #6,$bfe001
bne.s wb2
cmp.w #25,mousey
blt.s wb2
cmp.w #40,mousey
bgt.s wb2
cmp.w #230,mousex
blt.s wb2
clr.w d4
cmp.w #260,mousex
blt.s exit
st d4
cmp.w #290,mousex
bgt.s wb2
exit:
rts
nowinn:
st d4
rts
playerhandler:
move.w player,d0
lea collook,a0
add.w d0,d0
move.w 0(a0,d0.w),pointercol
rts
morphhandle:
lea sequences,a1
lea datatable,a2
lea inusetable,a4
lea morphtable,a0
tst.w (a0)
beq.s nomorphs
move.w 2(a0),d0
move.w 4(a0),d1
move.w d0,d4
move.w d1,d5
mulu #10,d5
add.w d5,d4
clr.l d5
move.b 0(a2,d4.w),d5
add.w d5,d5
add.w d5,d5
move.l 0(a1,d5.w),a3
add.w 6(a0),a3
add.w #2,6(a0)
move.w (a3),d2
blt.s endmorph
move.w 8(a0),d3
mulu #19*3,d3
add.w d3,d2
bsr drawblock
nomorphs:
rts
endmorph:
add.b #1,0(a2,d4.w)
clr.w (a0)
clr.b 0(a4,d4.w)
bsr checkreactions
bsr rubexplosion
lea playersin,a0
playerout:
add.w #1,player
move.w players,d6
cmp.w player,d6
bge.s firstplayer
clr.w player
firstplayer:
move.w player,d0
tst.b 0(a0,d0.w)
beq.s playerout
rts
noreact:
rts
checkreactions:
tst.w quitflag
bne.s noreact
movem.l d0-7/a0-6,-(sp)
move.w d0,d2
move.w d1,d3
mulu #10,d3
add.w d2,d3
move.w d3,d4
move.w d0,d2
move.w d1,d3
ext.l d2
ext.l d3
divu #10,d2
divu #6,d3
swap d2
swap d3
tst.w d2
beq.s edge1
cmp.w #9,d2
beq.s edge1
tst.w d3
beq.s edge2
cmp.w #5,d3
beq.s edge2
centre:
move.w #4,d3
bra.s checkexplode
edge1:
tst.w d3
beq.s corner
cmp.w #5,d3
beq.s corner
bra.s edge3
edge2:
tst.w d2
beq.s corner
cmp.w #9,d2
beq.s corner
edge3:
move.w #3,d3
bra.s checkexplode
corner:
move.w #2,d3
checkexplode:
lea datatable,a2
cmp.b 0(a2,d4.w),d3
ble.s explode
movem.l (sp)+,d0-7/a0-6
rts
explode:
bsr rubexplosion
lea ownertable,a3
lea inusetable,a4
clr.b 0(a2,d4.w)
clr.b 0(a4,d4.w)
clr.b 0(a3,d4.w)
move.w #19*12+1,d2
move.w #1,explosion
move.w d0,explosion+2
move.w d1,explosion+4
bsr drawblock
waitframe:
cmp.w #5,framecount
blt.s waitframe
clr.w framecount
move.w d1,-(sp)
addq #1,d1
bsr spread
subq #2,d1
bsr spread
move.w (sp)+,d1
addq #1,d0
bsr spread
subq #2,d0
bsr spread
bsr checkforwinner
movem.l (sp)+,d0-7/a0-6
rts
rubexplosion:
tst.w exp